home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld: Complete Mac Interactive
/
Macworld Complete Mac Interactive CD)(1994).iso
/
The Best of BMUG
/
Utilities
/
Text and Speech
/
Speaker1.14
/
Read Me
< prev
next >
Wrap
Text File
|
1994-05-18
|
11KB
|
363 lines
With the availability of the Speech Manager, i found few applications which could
take advantage of it. Since none are currently readily available, i decided to
make my own!
Speaker 1.14 is a no-frills text editor, with speech capabilities, which works
with TEXT files. Speaker will _NOT_ work without Apple's Speech Manager. So
far, the only place i know this is available from (aside from developer CD's)
is the internet at ftp.apple.com
Getting Speaker to Speak
------------------------
Speaker has several different speaking modes.
Note: Large voices such as the Macintalk Pro voices, require lots and lots
of memory. From my experience, at least 5 megabytes. This space is taken
by System meory, by the Speech Manager, so it is not necessary to change the
memory size of Speaker. Just have the memory available (i.e. around
2.5 megabytes of unused memory showing in the About This Macintosh dialog from
the Finder). Compressed voices take up much less memory.
Speaking by Return Key
The first speaking mode is by the Return key. Whenever you type something
and press return, Speaker will say the line you just typed. If you press
Return on a blank line, Speaker will repeat whatever was last spoken. If the
insertion cursor is moved to a line with text, and the return key is pressed,
the line which the cursor is in will be spoken.
To disable this speaking mode, toggle the Disable Speech item under the Voice
menu.
Speaking by Line
The next speaking mode is by line. Choose Speak Line from the File menu (or
command L) and the line in which the cursor is located will be spoken.
Speaking by File
To speak the entire file, choose Speak File from the File menu (or command F).
Speaking by Selection
To speak by selection, select the desired text to be spoken. Choose Speak
Selection from the File menu (or command I).
In addition, you may place the insertion point anywhere in your document
and choose Speak Selection. All text from the insertion point to the
end of the document will be spoken.
Speaking via Apple Events (Programmers only!)
To speaker via AppleEvents, send an AppleEvent to Speaker with the following attributes:
Event Class: kSpeechEventClass
Event ID: kAESpeakText
These are defined via:
#define kSpeechEventClass 'SPEK'
#define kAESpeakText 'Say '
Thus, your call to AECreateAppleEvent will look something like this:
err=AECreateAppleEvent(kSpeechEventClass,kAESpeakText,&target,kAutoGenerateReturnID,
kAnyTransactionID,&appleevent);
After creating the AppleEvent, use AEPutParamPtr to add a parameter of the following attr:
keyword: keyDirectObject
type: typeChar
Thus, your call to AEPutParamPtr will look something like this:
err=AEPutParamPtr(&theEvent,keyDirectObject,typeChar,thetext,length);
thetext represents a pointer to the text, and length is the length of the text.
Note: The limit of the text legnth is 32768 bytes!
Finally, when sending the AppleEvent via AESend, do not request a reply--you won't get one!
the call looks something like:
err=AESend(&theEvent,&reply,kAENoReply+kAENeverInteract,kAEHighPriority,
kAEDefaultTimeout,idleproc,nil);
Aborting Speech
Speech can be abored by clicking the mouse.
Changing Voice, Pitch, and Rate
-------------------------------
Change the voice, pitch, or rate by choosing the corresponding item from under the
Voice menu.
Note: Some voices are a little picky about pitch and rate. Thus, values will
be rounded to the nearest amount which the voice will accept.
In the event that voices are added or removed while Speaker is running, use the
Update Voices menu choice to update the voice list.
Saving the Default Voice
If there is a particular voice which you want to be automatically selected when
Speaker is launched, save the voice as the default.
To save the default voice: 1. Choose the voice. 2. Select "Save Default Voice" from
the voice menu.
Preferences
-----------
Speaker can now automatically speak a) files which are openned from the finder (i.e.,
drag and drop) or b) files which are openned via the File menu.
Dictionaries
------------
Sometimes, words are mispronounced. Dictionaries help alleviate this problem
by allowing you to specify the correct proununciation through the use of phonemes.
Phonemes are symbolic representations of the various, common sounds found in
speech. For example, "bout" and "how" have the same 'o' sound, even though they
are spelled diferently. Thus, the same phoneme would be used to represent this
'o' sound.
Dictionary information is kept in a file called "Dictionary." This allows
you to use other people's dictionaries, fairly easily, by replacing this
file with the new dictionary. In the future, i may add an import capability
or something, but i hope the current configuration is good enough for now.
To enter a new Dictionary entry:
1. Type in the word to convert in the text field.
Note:Avoid using capital letters. The Macintalk Pro voices don't seem to like
them.
2. Click on the Convert button.
This button converts the word you typed into phonemes. This will be the speaker's
"best guess". This button alleviates the need of making a phoneme
from scratch.
3. Edit the Phoneme.
See below for a summary of phonemes and other codes.
4. Click on the Speak It button to test the pronunciation of the word.
5. When you are satisfied, click on the New button.
If an entry has already been made, under the exact same word, The Speaker
beep because it does not allow duplicate dictionary entries.
To change a Dictionary Entry:
1. Click on the Dictionary Entry in the Entry list.
2. Change either the word itself, or the phoneme which represents it.
3. Test the pronunciation with the Speak It button.
4. When satisfied with the changes, click on the Replace button.
To delete a Dictionary Entry:
1. Click on the Dictionary Entry in the Entry list.
2. Click on the Delete button.
There is a limit of 256 character for dictionary entries and their phoneme counterparts.
Memory cavaet! If The Speaker is unsuccessful in loading the speech channel (usually
because there is not enough memory) the Convert to phonemes and Say It functions will
not work! This is very, very very true when you try to use the Macintalk Pro voices
which take up gobs and gobs of memory!
Technical Notes
---------------
For programmers interested in the dictionaries used in The Speaker: The dictionary
resource is of type 'dict' and is id #128. Just use ResEdit to copy it out.
Currently, The Speaker's dictionary resources are modeled after the example dictionary
Rez file which came with the Speech Manager. Thus, (in case you're importing
dictionaries into the Speaker) it does not support abreviation entries, and accepts
no more and no less than two fields per entry, the first one begin the text
representation, the second being the phoneme.
Also, you might notice the dictionary list is not sorted. Version 1.11 now sorts
the list. Unfortunately, i only implemented a selection sort, which is kinduv slow.
Thus, the request is still here for some nice quicksort code, which sorts an array
of n items of any size.
Phonemes Codes and Prosodic Controls
------------------------------------
More information on Phonemes can be found in the Speech Manager Documentation,
available at ftp.apple.com, in the same directory as the Speech Manager itself.
Note: Phoneme codes are case sensitive!
Phoneme Example Phoneme Example
------- ------- ------- -------
AE h<a>t g <g>reat
EY g<a>te h <h>ope
AO b<au>ght J <j>oke
AX <a>gast k <c>ool
IY m<ee>t l <l>oom
EH m<e>t m <m>ace
IH b<i>t n <kn>ock
AY b<i>te N ba<ng>
IX clos<e>s p <p>ing
AA l<o>t r <wr>ong
UW l<oo>t s <s>atin
UH c<oo>k S <sh>oes
UX m<u>d t <t>alk
OW <oa>t T <th>eme
AW b<ou>t v <v>isit
OY t<oy> w <w>alk
b <b>eam y <y>ank
C <ch>oke z <z>ebra
d <d>ark Z <j>aque <g>enre
D <th>ose % silence
f <f>ake @ breath intake
Examples:
Word: Anticipation Supercede
Phoneme: AEntIHsIXpEYSAXn _sUWpAXrsIYd
Posodic Codes
-------------
These are used in conjunction with phonemes to fine tune pronunciation.
Code Description
Stresses
Primary Stress 1 AEnt2IHsIXp1EYSAXn
Secondary Stress 2 (anticipation)
Syllables
Syllable break = Breaks up word into Syllables
AEn=t2IH=sIX=p1EY=SAXn
(anticipation)
Word Prominence
Unstressed ~
Normal Stress _ (underscore)
Emphatic Stress +
Prosodic
Pitch rise /
Pitch fall \
Lengthen phoneme >
Shorten phoneme <
Examples:
Anticipation
AEn=t2IH=sIX=p1EY=SAXn
Various punctuation marks further adjust timing and are sometimes useful
when dealing with sentences. See the Speech Manager documentation for more info.
Macros and Embedded Speech Commands (advanced)
----------------------------------------------
Speaker allows you to save commonly used strings in a file named Speaker Macros.
Every line in this file is considered a seperate macro. Blank lines are ignored.
Currently, this file contains Speech Manager commands which can be embedded in
spoken text to alter the way text is spoken. Open the file named "Embedded Codes
Demo" for various examples.
Macro lines have a limit of 256 characters. There is a current Macro limit of
1000 (should be more than enough since i've never seen a menu with 1000 items
in it!).
To re-read the macros file (in case it has/is changed while Speaker is running),
choose the Re-Read File item from the Macros menu. If you edit the file from
within Speaker, you must close the file before re-reading it.
Distribution
------------
You may non-commercially distribute this software provided all files that came
with this archive remain intact, un-modified, and together.
Oh, and by the way, this software is FREE. Have fun with it.
Disclaimer
----------
There is no expressed waranty, etc, etc., etc. Use this software at your own
risk.
The purpose of this software is not to crash your machine, but if it trashes
your hard drive which contains $1,000,000 worth of client data on it, and
you don't have a backup (shame, shame!), don't come looking for me to collect
damages.
Nostalgia Note
--------------
Back in the old days, when the Apple // was fairly prominent, there were a
couple programs that did similar stuff to the Speech Manager. A neat one
was called the Cat's Meow which worked with the good o'l Apple Cat modem,
and allowed you to transmit speech directly to the phone. Neat little toy.
The current Macintalk voices don't sound too much better than those generated
on the 1982 Apple //....Hope Apple makes some better voices.
Questions? Suggestions? Source Code needed?
-------------------------------------------
If you have any questions, or suggestions, write me! If you want source code,
my only request is that you have an e-mail account on the internet (because this
doesn't cost me $$), and that if you copy source code, ya give me a little
credit (one of those option-command-control-drag-click menus/dialogs would
be fine!).
Internet: eshieh@cory.berkeley.edu
Compuserve: 76164,765
US Postal:
Eric Shieh
P.O. Box 1235
Danville, CA 94526